package com.example;

import com.example.config.ElasticSearchConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.util.ResourceUtils;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;


@SpringBootApplication
@EnableCaching
@EnableScheduling
@EnableConfigurationProperties(ElasticSearchConfig.class)
public class MydemoApplication extends WebMvcConfigurationSupport {
        public static void main(String[] args) {
            SpringApplication.run(MydemoApplication.class, args);
        }

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/static/");
        registry.addResourceHandler("/static/lib/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/static/lib/");
        registry.addResourceHandler("/static/css/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/static/css/");
        registry.addResourceHandler("/static/js/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/static/js/");
        registry.addResourceHandler("/js/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/js/");
        registry.addResourceHandler("/static/api/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/static/api/");
        registry.addResourceHandler("/images/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/images/");
        registry.addResourceHandler("/templates/param/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "param/");
        super.addResourceHandlers(registry);}
}

